/**
 * 
 */
package es.ats.codington.festival.services;

import java.sql.Connection;

import es.ats.codington.festival.utils.FERSDataConnection;

/**
 * The Class ServiceManager.
 *
 * @author 5Cs
 */
public class ServiceManager {
		
	/**
	 * Open connection to db.
	 *
	 * @return the connection
	 * @throws Exception the exception
	 */
	public Connection OpenConnectionToDB () throws Exception{		
		
		//Obtaining a connection
		Connection con = FERSDataConnection.getConnection();
		if(con != null)
		{
		//	System.out.println("Connection successfully established!");
		}
		try{		
			//Setting autoCommit to false 
			con.setAutoCommit(false);
		}catch (Exception e){
			System.out.println(e.getMessage());
		}
		return con;	
	}
	
	/**
	 * Close connection to db.
	 *
	 * @param con the con
	 * @throws Exception the exception
	 */
	public void CloseConnectionToDB (Connection con) throws Exception{
		//Closing the connection
		con.close();
	}
}
